{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "now = datetime.now()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2019, 7, 2, 22, 14, 55, 352291)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "now"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2019, 7, 2)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "now.year, now.month, now.day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.timedelta(1906)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 日期差\n",
    "delta = datetime(2019, 6, 30) - datetime(2014, 4, 11)\n",
    "delta"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1906"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "delta.days"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "delta.seconds"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2011, 1, 3, 0, 0)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 字符串和datetime的相互转换\n",
    "stamp = datetime(2011, 1, 3)\n",
    "stamp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2011-01-03 00:00:00'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str(stamp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2011-01-03'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stamp.strftime('%Y-%m-%d')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[datetime.datetime(2011, 7, 6, 0, 0), datetime.datetime(2011, 8, 6, 0, 0)]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datestrs = ['7/6/2011', '8/6/2011']\n",
    "[datetime.strptime(x, '%m/%d/%Y') for x in datestrs]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "from dateutil.parser import parse"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.datetime(2019, 6, 30, 0, 0)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "parse('2019-06-30')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 时间序列基础\n",
    "dates = [datetime(2019, 1, 2), datetime(2019, 1, 5),\n",
    "         datetime(2019, 1, 7), datetime(2019, 1, 8),\n",
    "         datetime(2019, 1, 10), datetime(2019, 1, 12)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[datetime.datetime(2019, 1, 2, 0, 0),\n",
       " datetime.datetime(2019, 1, 5, 0, 0),\n",
       " datetime.datetime(2019, 1, 7, 0, 0),\n",
       " datetime.datetime(2019, 1, 8, 0, 0),\n",
       " datetime.datetime(2019, 1, 10, 0, 0),\n",
       " datetime.datetime(2019, 1, 12, 0, 0)]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "ts = pd.Series(np.random.randn(6), index=dates)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2019-01-02   -0.190443\n",
       "2019-01-05    0.342182\n",
       "2019-01-07   -0.736650\n",
       "2019-01-08    1.506760\n",
       "2019-01-10   -0.483160\n",
       "2019-01-12   -0.362953\n",
       "dtype: float64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2019-01-02', '2019-01-05', '2019-01-07', '2019-01-08',\n",
       "               '2019-01-10', '2019-01-12'],\n",
       "              dtype='datetime64[ns]', freq=None)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2019-01-02   -0.380886\n",
       "2019-01-05         NaN\n",
       "2019-01-07   -1.473301\n",
       "2019-01-08         NaN\n",
       "2019-01-10   -0.966321\n",
       "2019-01-12         NaN\n",
       "dtype: float64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts + ts[::2] # 每隔2个取一个"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dtype('<M8[ns]')"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.index.dtype  # 纳秒形式存储时间戳"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2019-01-02 00:00:00')"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.index[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.7366504854766907"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 索引，选区，子集构造\n",
    "stamp = ts.index[2]\n",
    "ts[stamp]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "longer_ts = pd.Series(np.random.randn(1000), \n",
    "                      index=pd.date_range('1/1/2000', periods=1000))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2000-01-01    0.162119\n",
       "2000-01-02    1.433551\n",
       "2000-01-03    0.510147\n",
       "2000-01-04    1.772391\n",
       "2000-01-05    0.114302\n",
       "2000-01-06   -1.086444\n",
       "2000-01-07    0.536840\n",
       "2000-01-08    0.129754\n",
       "2000-01-09    1.508511\n",
       "2000-01-10    0.329723\n",
       "2000-01-11   -0.143566\n",
       "2000-01-12    0.285703\n",
       "2000-01-13   -1.534057\n",
       "2000-01-14    1.404190\n",
       "2000-01-15   -0.301957\n",
       "2000-01-16    0.673835\n",
       "2000-01-17    0.336577\n",
       "2000-01-18   -1.289172\n",
       "2000-01-19   -0.409302\n",
       "2000-01-20    0.534191\n",
       "2000-01-21    0.515491\n",
       "2000-01-22    1.452431\n",
       "2000-01-23   -0.940444\n",
       "2000-01-24   -0.857931\n",
       "2000-01-25   -0.650376\n",
       "2000-01-26    1.541682\n",
       "2000-01-27    0.398249\n",
       "2000-01-28   -0.401186\n",
       "2000-01-29   -0.640446\n",
       "2000-01-30    0.922973\n",
       "                ...   \n",
       "2002-08-28   -0.877998\n",
       "2002-08-29    0.974266\n",
       "2002-08-30   -0.185853\n",
       "2002-08-31   -0.650251\n",
       "2002-09-01   -0.711474\n",
       "2002-09-02    0.784191\n",
       "2002-09-03    0.038635\n",
       "2002-09-04    0.355216\n",
       "2002-09-05   -0.395789\n",
       "2002-09-06   -0.332372\n",
       "2002-09-07   -1.149431\n",
       "2002-09-08   -0.703746\n",
       "2002-09-09    0.851703\n",
       "2002-09-10    0.295404\n",
       "2002-09-11   -0.103528\n",
       "2002-09-12   -0.704519\n",
       "2002-09-13   -0.909294\n",
       "2002-09-14   -1.236715\n",
       "2002-09-15   -0.756685\n",
       "2002-09-16    1.269863\n",
       "2002-09-17   -1.386696\n",
       "2002-09-18   -2.203270\n",
       "2002-09-19   -0.721010\n",
       "2002-09-20    1.677054\n",
       "2002-09-21    0.611110\n",
       "2002-09-22    0.189923\n",
       "2002-09-23    0.777055\n",
       "2002-09-24    0.548378\n",
       "2002-09-25    1.676423\n",
       "2002-09-26    0.754746\n",
       "Freq: D, Length: 1000, dtype: float64"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "longer_ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2001-01-01   -0.338317\n",
       "2001-01-02    0.864624\n",
       "2001-01-03   -0.046992\n",
       "2001-01-04    0.729551\n",
       "2001-01-05    1.585454\n",
       "2001-01-06   -0.159434\n",
       "2001-01-07   -0.227954\n",
       "2001-01-08   -0.934395\n",
       "2001-01-09    0.015685\n",
       "2001-01-10   -0.331726\n",
       "2001-01-11   -0.962147\n",
       "2001-01-12    0.546335\n",
       "2001-01-13    0.307737\n",
       "2001-01-14   -1.320664\n",
       "2001-01-15   -0.208651\n",
       "2001-01-16    0.182042\n",
       "2001-01-17   -0.633414\n",
       "2001-01-18   -0.770537\n",
       "2001-01-19    0.481936\n",
       "2001-01-20    1.558265\n",
       "2001-01-21    1.126340\n",
       "2001-01-22    0.384133\n",
       "2001-01-23    0.847042\n",
       "2001-01-24   -0.213512\n",
       "2001-01-25    0.143911\n",
       "2001-01-26    0.816687\n",
       "2001-01-27    0.326932\n",
       "2001-01-28    0.463298\n",
       "2001-01-29   -1.027193\n",
       "2001-01-30    0.376256\n",
       "                ...   \n",
       "2001-12-02   -0.081155\n",
       "2001-12-03    0.750262\n",
       "2001-12-04    0.482291\n",
       "2001-12-05    1.440312\n",
       "2001-12-06    0.137144\n",
       "2001-12-07   -1.658001\n",
       "2001-12-08    0.046183\n",
       "2001-12-09   -0.758478\n",
       "2001-12-10    0.930811\n",
       "2001-12-11    0.428288\n",
       "2001-12-12   -1.102417\n",
       "2001-12-13   -1.237593\n",
       "2001-12-14   -0.452455\n",
       "2001-12-15   -1.380814\n",
       "2001-12-16    0.157501\n",
       "2001-12-17   -1.382613\n",
       "2001-12-18    1.166881\n",
       "2001-12-19    0.465641\n",
       "2001-12-20    0.671617\n",
       "2001-12-21    0.127051\n",
       "2001-12-22   -0.916683\n",
       "2001-12-23    1.203389\n",
       "2001-12-24    1.851146\n",
       "2001-12-25    0.319068\n",
       "2001-12-26   -1.606828\n",
       "2001-12-27    0.363525\n",
       "2001-12-28    0.826465\n",
       "2001-12-29    1.080810\n",
       "2001-12-30    0.738381\n",
       "2001-12-31   -1.447995\n",
       "Freq: D, Length: 365, dtype: float64"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "longer_ts['2001']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2019-01-07   -0.736650\n",
       "2019-01-08    1.506760\n",
       "2019-01-10   -0.483160\n",
       "2019-01-12   -0.362953\n",
       "dtype: float64"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts[datetime(2019, 1, 7):]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 带有重复索引的时间序列\n",
    "dates = pd.DatetimeIndex(['1/1/2000', '1/2/2000', '1/2/2000',\n",
    "                          '1/2/2000', '1/3/2000'])\n",
    "dup_ts = pd.Series(np.arange(5), index=dates)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2000-01-01    0\n",
       "2000-01-02    1\n",
       "2000-01-02    2\n",
       "2000-01-02    3\n",
       "2000-01-03    4\n",
       "dtype: int64"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dup_ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dup_ts.index.is_unique"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "grouped = dup_ts.groupby(level=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2000-01-01    1\n",
       "2000-01-02    3\n",
       "2000-01-03    1\n",
       "dtype: int64"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "grouped.count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2019-01-02   -0.190443\n",
       "2019-01-05    0.342182\n",
       "2019-01-07   -0.736650\n",
       "2019-01-08    1.506760\n",
       "2019-01-10   -0.483160\n",
       "2019-01-12   -0.362953\n",
       "dtype: float64"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 11.3日期的范围、频率以及移动\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "resampler = ts.resample('D')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndexResampler [freq=<Day>, axis=0, closed=left, label=left, convention=start, base=0]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "resampler"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2019-01-02   -0.190443\n",
       "2019-01-05    0.342182\n",
       "2019-01-07   -0.736650\n",
       "2019-01-08    1.506760\n",
       "2019-01-10   -0.483160\n",
       "2019-01-12   -0.362953\n",
       "dtype: float64"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 频率和日期偏移量\n",
    "from pandas.tseries.offsets import Hour, Minute"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Hour>"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "hour = Hour()\n",
    "hour"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "four_hours = Hour(4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<4 * Hours>"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "four_hours"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2019-01-01 00:00:00', '2019-01-01 04:00:00',\n",
       "               '2019-01-01 08:00:00', '2019-01-01 12:00:00',\n",
       "               '2019-01-01 16:00:00', '2019-01-01 20:00:00',\n",
       "               '2019-01-02 00:00:00', '2019-01-02 04:00:00',\n",
       "               '2019-01-02 08:00:00', '2019-01-02 12:00:00',\n",
       "               '2019-01-02 16:00:00', '2019-01-02 20:00:00',\n",
       "               '2019-01-03 00:00:00', '2019-01-03 04:00:00',\n",
       "               '2019-01-03 08:00:00', '2019-01-03 12:00:00',\n",
       "               '2019-01-03 16:00:00', '2019-01-03 20:00:00'],\n",
       "              dtype='datetime64[ns]', freq='4H')"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.date_range('2019-01-01', '2019-01-03 23:59', freq='4h')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2019-01-02   -0.190443\n",
       "2019-01-05    0.342182\n",
       "2019-01-07   -0.736650\n",
       "2019-01-08    1.506760\n",
       "2019-01-10   -0.483160\n",
       "2019-01-12   -0.362953\n",
       "dtype: float64"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 移动数据\n",
    "ts"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2019-01-02         NaN\n",
       "2019-01-05         NaN\n",
       "2019-01-07   -0.190443\n",
       "2019-01-08    0.342182\n",
       "2019-01-10   -0.736650\n",
       "2019-01-12    1.506760\n",
       "dtype: float64"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ts.shift(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 移动窗口函数\n",
    "close_px_all = pd.read_csv('stock_px_2.csv', parse_dates=True, index_col=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "DatetimeIndex: 2214 entries, 2003-01-02 to 2011-10-14\n",
      "Data columns (total 4 columns):\n",
      "AAPL    2214 non-null float64\n",
      "MSFT    2214 non-null float64\n",
      "XOM     2214 non-null float64\n",
      "SPX     2214 non-null float64\n",
      "dtypes: float64(4)\n",
      "memory usage: 86.5 KB\n"
     ]
    }
   ],
   "source": [
    "close_px_all.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "close_px = close_px_all[['AAPL', 'MSFT', 'XOM']]\n",
    "close_px = close_px.resample('B').ffill()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7f8cdbb6a0>"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "close_px.AAPL.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7f8cc65be0>"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvAOZPmwAAIABJREFUeJzt3Xl4VOX9/vH3h5CEQNgTdjAsYVcWA4KC4g5axV2srdaitFW/1Vb9Vu2mbe3PatWWttqiYsG1WDdURBBoUWRpQNawJOwhIQkEEpKQ/fn9kUO/KQ1km8mZJPfruuaamTNnztwJyZ3DM+c8Y845RESkeWjhdwAREWk4Kn0RkWZEpS8i0oyo9EVEmhGVvohIM6LSFxFpRlT6IiLNiEpfRKQZUemLiDQjLf0OABATE+Pi4uL8jiEi0qisXbv2kHMutjbPCYnSj4uLIzEx0e8YIiKNipntre1zNLwjItKMqPRFRJoRlb6ISDOi0hcRaUaqLX0za2Vma8xsg5ltMbPHveV/NbPdZrbeu4z0lpuZzTSzFDPbaGajg/1FiIhIzdTk6J0i4CLnXJ6ZhQNfmNkn3mMPOef+ftL6U4B473IO8IJ3LSIiPqt2T99VyPPuhnuX033c1lRgrve8VUAHM+te/6giIlJfNRrTN7MwM1sPZAKLnXOrvYee8IZwnjOzSG9ZT2B/paenestERKSS3322g3X7jjToa9ao9J1zZc65kUAvYKyZDQceAQYDY4BOwI+81a2qTZy8wMxmmFmimSVmZWXVKbyISGO1dFsGv/ssmeU7Grb/anX0jnPuKPAPYLJzLt0bwikCXgHGequlAr0rPa0XkFbFtmY55xKccwmxsbU6i1hEpFFLSsvlvjfXM7R7O75zfv8Gfe2aHL0Ta2YdvNtRwCXAthPj9GZmwDXAZu8p84HbvKN4xgE5zrn0oKQXEWlkikrL+N7ra4lu1ZKXbk8gKiKsQ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ohIMxKywzsiIhJ4Kn0RkWZEpS8i0oyo9EVEmhGVvohIM6LSFxFpRlT6IiLNiEpfRKQZ+f/K2w84cUvCHwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f8ccbe320>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "close_px.AAPL.rolling(250).mean().plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
